package initial

import (
	"github.com/astaxie/beego"
	"public_security/databases"
	"public_security/initial/corn"
	"public_security/initial/seeds"
)

func init() {
	databases.MysqlInit(beego.AppConfig.String("DefaultDriver"), beego.AppConfig.String("DefaultDsn"))
	dblog, _ := beego.AppConfig.Bool("DbLog")
	databases.DbDefault.LogMode(dblog)
	need, _ := beego.AppConfig.Bool("NeedSeeds")
	if need {
		seeds.InitTable()
	}
	corn.StartCorn()

}

func Close() {
	databases.DbDefault.Close()
}
